(1) Field of the Invention
The invention relates generally to image processing and more specifically to gamma curve adjustment.
(2) Description of the Related Art
Gamma refers to a value, typically denoted by the Greek letter γ (i.e., gamma), used to quantify contrast of an image, such as a photographic or video image. Gamma represents the slope of a curve relating a logarithmically expressed output value to a logarithmically expressed input value, according to the following equation:
  γ  =                    ⅆ                  log          ⁡                      (                          V              out                        )                                      ⅆ                  log          ⁡                      (                          V              in                        )                                .  
As images are processed using different technologies, different values of gamma may be appropriate for different circumstances. As images are transferred among systems or subsystems, it may be appropriate to adjust the gamma values. Also, because of the typical nonlinearity of gamma curves, adjustment of gamma values may be used to obtain compression of information denoting contrast of an image when such information is stored or transmitted, allowing more faithful retrieval or reception of the image represented by the information. Thus, one gamma curve may be used for encoding an image for storage, transmission, and/or processing, while another gamma curve may be used for decoding the image for retrieval, reception, processing, or display. When encoding image data, such data may include gamma-encoded values rather than linear intensity values. When such data are decoded, gamma adjustment can be performed using gamma curves appropriate for any desired output devices, such as display devices. For example, images may be encoded with a gamma of about 0.45 and decoded with a gamma of 2.2, which is typical of common display devices.
A gamma curve can be used to approximate a relationship between a encoded luminance value in a image processing system, such as a television system or computer system, and the actual desired image luminance. As a gamma curve is typically approximated by a power-law relationship, a gamma curve typically exhibits nonlinearity. In accordance with such nonlinearity, equal steps in encoded luminance correspond roughly to subjectively equal steps in brightness. Because the physics of display devices causes display devices to respond nonlinearly to input signals, gamma curve adjustment can be used to compensate for display device characteristics. For example, a cathode ray tube (CRT), converts an applied voltage to light nonlinearly because the phosphor coating on its screen responds nonlinearly. A CRT provides a light intensity I in proportion to a source voltage raised to the power gamma, as showing in the following equation:I∝VSγ
Specific values of gamma are standardized for particular formats, such as the NTSC, PAL, and SECAM video formats. Other values of gamma may be applicable to other signal capture, storage, processing, and display devices. For a CRT such as those typically used a computer display device, γ is typically about 2.2. In the case of a monochrome CRT, when a video signal having a level of 0.0 is provided to the display, a pure black output is produced, and when a video signal having a level of 1.0 is provided to the display, a pure white output is produced. Thus, those two extremes represent points on the curves that are common among different gamma curves. Other values that lie between those points, such as a level of a video signal having a value of 0.5, which represents a middle shade of gray, yield an intensity that depends on the particular gamma curve. For example, if the value of 0.5 were to be provided to a display having a gamma of 2.2, the resulting intensity (e.g., brightness) on the display would be about 0.22, which would be a darker-than-desired shade of gray.
The nonlinearity of the display device that would otherwise result in significant error can be compensated for by applying an inverse transfer function such that the system response is substantially linear. Thus, the inverse transfer function essentially nonlinearly alters a video signal to become an altered video signal that is then altered back to its desired form by the nonlinearity of the display device. An example of an inverse transfer function is as follows:VC∝VS(1/γ) where VC is the corrected voltage being provided as an output of the inverse transfer function and VS is the source voltage being received as an input to the inverse transfer function. For example, if γ is 2.2, then the inverse of γ is 1/γ, which is equal to 1/2.2 or 0.45 in that example.
While a monochrome example has been discussed, gamma curve adjustment can also be applied to color images by adjusting the color parameters of the color images. For example, in a system where colors are expressed as weighted combinations of the primary colors red, green, and blue, each of the red, green, and blue color parameters can have its own corresponding gamma attribute, which can be denoted as γR, γG, and γB, respectively, or a single gamma attribute can be applied to all three color parameters.
Gamma curve adjustment can be applied to a variety of image formats, such as still images and video images. Gamma curve adjustment can be used to adjust a nonlinear operation by which attributes of the images, such as contrast and luminance, may be encoded and decoded. The application of gamma curve adjustment to an image may be described by the following power-law transfer function:Vout=Vinγwhere the input value Vin and the output value Vout are non-negative real values, typically within a defined range such as between zero and one (i.e., normalized). Other ranges of the input value Vin and the output value Vout can be accommodated by mathematically converting them (e.g., normalizing them) to and/or from the defined range. Gamma values less than one are typically used for encoding, while gamma values greater than one are typically used for decoding. The nonlinearity of the transfer function and the inverse relationship of the encoding and decoding gamma values allow compression and expansion of the dynamic range of image parameters, such as contrast and luminance, within the range over which their values may be encoded and decoded. Thus, a wider range of such image parameters can be accommodated using a smaller range of possible data values (e.g., number of bits representative of the encoded data), which can reduce data storage, transmission, and processing requirements. If normalized values of the input value Vin and the output value Vout are used, the power-law transfer function set forth above provides that an input value Vin of zero will yield an output value Vout of zero and that an input value Vin of one will yield an output value Vout of one, regardless of the value of gamma. However, different values of gamma will cause a specific input value Vin, where 0<Vin<1, to yield a different output value Vout for each respective different value of gamma. Thus, the respective gamma curves will differ for the respective different values of gamma.
While gamma curves can be implemented so as to conform continuously to a single mathematical expression, more complex implementations of gamma curves can be used, for example, a gamma curve that comprises multiple sections with each section conforming to a different mathematical relationship. For example, to avoid having the slope of a gamma curve become infinite at zero, which could be arithmetically inconvenient, a section of the gamma curve near zero can be approximated by a linear relationship, while a section of the gamma curve farther from zero can be approximated by a nonlinear relationship. Such approximations are usually tolerable in that error is typically relatively insignificant and unobjectionable.
In modern digital applications, the gamma function is normally implemented in a look-up table (LUT), which is typically a static random-access memory (RAM) device addressed by the input video signal, with the RAM data output producing the video signal modified according to the gamma curve data stored in the static RAM device. If a video processor is required to incorporate several gamma functions, it either utilizes a limited number of LUTs (e.g., RAMs) between which the video processor can switch in a fast and straightforward manner, or one or more LUTs (e.g., RAMs) that are downloaded with different gamma curve data every time a mode or application changes. In either case, fine-tuning the gamma curve “on the fly” is hardly practical, since it requires both storage of large amounts of data for various pre-set gamma tables in the system memory and/or continuous data downloads of these pre-stored data.
Prior-art adaptive piece-wise gamma approximation methods, such as the one proposed by Lin in U.S. Pat. No. 6,293,165 B1, are complex and require substantial hardware resources. The linear gamma approximation methods are imprecise, and the systems that use digital correction for linear gamma approximation, such as described by Mourik in U.S. Pat. No. 6,137,542, are not intended for producing hundreds of continuously synthesizable gamma curves.
Thus, a technique is needed for efficiently providing gamma curve adjustment over a wide range of variable gamma curves using minimal resources.